/**
 * InvoiceModel 业务逻辑实现类
 * @author zhangq
 * @date 2015-03-12
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.InvoiceModel;
import com.chnbst.bstyun.model.vo.InvoiceModelVo;
import com.chnbst.bstyun.service.InvoiceModelService;

@Transactional
@Service
public class InvoiceModelServiceImpl extends BaseService implements InvoiceModelService {
	
	//声明命名空间
	private final static String nameSpace = "com.chnbst.bstyun.mapper.InvoiceModelMapper";

	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertInvoiceModel(InvoiceModel invoiceModel) {
		return DaoHelper.insert(nameSpace, "insertInvoiceModel", invoiceModel);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteInvoiceModel(Integer invoiceModelId) {
		return DaoHelper.delete(nameSpace, "deleteInvoiceModel", invoiceModelId);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public InvoiceModel selectInvoiceModel(Integer invoiceModelId) {
		return (InvoiceModel)DaoHelper.query(nameSpace, "selectInvoiceModel", invoiceModelId);
	}

	@Override
	public InvoiceModel selectByCondition(Map<String, Object> map) {
		return (InvoiceModel)DaoHelper.query(nameSpace, "selectByCondition", map);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public int selectInvoiceModelCount(Map<String, Object> map) {
		return DaoHelper.count(nameSpace, "selectInvoiceModelCount", map);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@SuppressWarnings("unchecked")
	@Override
	public List<InvoiceModelVo> selectInvoiceModelVos(Map<String, Object> map) {
		return (List<InvoiceModelVo>)DaoHelper.list(nameSpace, "selectInvoiceModelVos", map);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public InvoiceModelVo selectInvoiceModelVo(Integer invoiceModelId) {
		return (InvoiceModelVo)DaoHelper.query(nameSpace, "selectInvoiceModelVo", invoiceModelId);
	}
}